cmake_minimum_required(VERSION 3.21)
project(c0)

set(CMAKE_CXX_STANDARD 23)

find_package(BISON)
find_package(FLEX)

BISON_TARGET(MyParser grammar/c0parser.y ${CMAKE_CURRENT_BINARY_DIR}/c0parser.cpp)
FLEX_TARGET(MyScanner grammar/c0lexer.l ${CMAKE_CURRENT_BINARY_DIR}/c0lexer.cpp)
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)

include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(c0
        src/main.cpp
        ${BISON_MyParser_OUTPUTS}
        ${FLEX_MyScanner_OUTPUTS}
        src/ast.cpp
        src/BuildSym.cpp
        src/CodeGenerator.cpp
        src/Interpreter.cpp
        src/TypeChecker.cpp)
target_link_libraries(c0 ${FLEX_LIBRARIES})